package com.competition.web.admin.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.competition.web.admin.service.ICacheService;
import com.response.vo.ResponseModel;

@RestController
@RequestMapping("cache")
public class CacheController {
	
	private ICacheService cacheService;

	@PostMapping("resizeOrganize")
	public ResponseModel<Integer> resizeOrganize() {
		
		this.cacheService.resizeOrganize();
		
		return ResponseModel.<Integer>success(1);
	}
	
	@PostMapping("resizeCache")
	public ResponseModel<Integer> resizeCache() {
		
		this.cacheService.resizeOrganize();
		
		this.cacheService.resizeCityCondition();
		
		return ResponseModel.<Integer>success(1);
	}
	
	@PostMapping("loadTanma")
	public ResponseModel<Integer> loadTanma() {
		
		this.cacheService.loadTanma();
		
		return ResponseModel.<Integer>success(1);
	}
	
	@PostMapping("resizeCityCondition")
	public ResponseModel<Integer> resizeCityCondition() {
		
		this.cacheService.resizeCityCondition();
		
		return ResponseModel.<Integer>success(1);
	}

	@Resource
	public void setCacheService(ICacheService cacheService) {
		this.cacheService = cacheService;
	}
	
}
